d82e12893c1324f04d2123be12789cb2dd94d802,src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBaseElementBuilder.java,AbstractBaseElementBuilder,setTargetCoordinates,#BpmnShape#,303

Before Change


  }

  protected void setTargetCoordinates(BpmnShape targetBpmnShape) {
    Bounds elemBounds = findBpmnShape(element).getBounds();
    Bounds bounds = targetBpmnShape.getBounds();

    double x = elemBounds.getX() + elemBounds.getWidth() + SPACE;

    double y = 0;
    Collection<SequenceFlow> outgoing = ((FlowNode) element).getOutgoing();
    if (outgoing.size() == 0) {
      y = elemBounds.getY() + elemBounds.getHeight() / 2 - bounds.getHeight() / 2;
    }
    else {
      SequenceFlow last = (SequenceFlow) outgoing.toArray()[outgoing.size()-1];
      FlowNode target = last.getTarget();
      BpmnShape lastBpmnShape = findBpmnShape(target);
      y = lastBpmnShape.getBounds().getY() + lastBpmnShape.getBounds().getHeight() + SPACE;
    }

    bounds.setX(x);

After Change


  }

  protected void setCoordinates(BpmnShape targetBpmnShape) {
    BpmnShape source = findBpmnShape(element);
    Bounds targetBounds = targetBpmnShape.getBounds();
    double x = 0;
    double y = 0;

    if (source != null) {
      Bounds sourceBounds = source.getBounds();

      Double sourceX = sourceBounds.getX();
      Double sourceWidth = sourceBounds.getWidth();
      x = sourceX + sourceWidth + SPACE;

      if (element instanceof FlowNode) {
        FlowNode flowNode = (FlowNode) element;
        Collection<SequenceFlow> outgoing = flowNode.getOutgoing();
        if (outgoing.size() == 0) {
          double sourceY = sourceBounds.getY();
          double sourceHeight = sourceBounds.getHeight();
          double targetHeight = targetBounds.getHeight();
          y = sourceY + sourceHeight / 2 - targetHeight / 2;
        } else {
          SequenceFlow last = (SequenceFlow) outgoing.toArray()[outgoing.size() - 1];
          FlowNode target = last.getTarget();
          BpmnShape lastBpmnShape = findBpmnShape(target);
          if (lastBpmnShape != null) {
            Double lastY = lastBpmnShape.getBounds().getY();
            Double lastHeight = lastBpmnShape.getBounds().getHeight();
            y = lastY + lastHeight + SPACE;
          }
        }
      }